/*
 * 统一分页组件
 */
import * as React from 'react';
import { Pagination } from 'antd';

function showTotal(total: number) {
  return `总共 ${total} 条`;
}

interface PaginProps {
  onChange: (page: number, pageSize: number) => void;
  total: number;
  current: number;
  pageSize?: number;
  showQuickJumper?: boolean;
}

const defaultProps: PaginProps = {
  onChange: () => {},
  total: 0,
  current: 1,
  pageSize: 10,
  showQuickJumper: true,
};

const CustomPagination: React.SFC<PaginProps> = props => {
  return <Pagination style={{ margin: 12, float: 'right' }} showTotal={showTotal} {...props} />;
};

CustomPagination.defaultProps = defaultProps;

export default CustomPagination;
